package demo06.Lambda;

import java.util.Scanner;

public class Demo01Calculator {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入a");
        int a=sc.nextInt();
        System.out.println("请输入b");
        int b=sc.nextInt();
        invokeCalc(a,b,(x,y)->{return x+y;});
        //简化的lambda表达式
        invokeCalc(a,b,(x,y)->x+y);
    }
    private static void invokeCalc(int a,int b, Calculator calculator){
        int result=calculator.calc(a, b);
        System.out.println("结果是:"+result);
    }
}
